<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>联动的下拉菜单</title>
<script src="<%=basePath %>js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">  
 $(function(){  
     $("#wc").change(function(){ 
         $.getJSON("<%=basePath %>/t2.jsp",{index: $(this).val()},function(myJSON){ 
             alert('sss'); 
             	var myOptions = ''; 
             	alert(myJSON); 
            		 for (var i = 0; i < myJSON.length; i++) {  
                 myOptions += '<option value="' + myJSON[i].optionValue + '">' + myJSON[i].optionValue + '</option>';                        }  
             		$("#gx").html(myOptions);  
         });  
     });   
     $("#wc").change();  
 })  
 </script>
</head>
<body>
<select name="wc" id="wc">
	<option>一</option>
	<option>二</option>
	<option>三</option>
</select>
<select name="gx" id="gx">
</select>
</body>
</html>
